<?xml version="1.0" encoding="utf-8" standalone="no"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2014-04-09T15:20:34" version="1.0">

	<xsl:output indent="yes" omit-xml-declaration="yes" encoding="utf-8" method="xml"/>
	<xsl:param name="sortField"/>
	<xsl:param name="sortOrder" select="ascending"/>
	<xsl:param name="sortType" select="text"/>
	
	<xsl:template match="node()|@*">
		<xsl:copy>
			<xsl:apply-templates select="node()|@*"/>
		</xsl:copy>
	</xsl:template>
	
	<xsl:template match="/*">
		<xsl:copy>
			<xsl:apply-templates select="@*" />
			<xsl:apply-templates>
				<xsl:sort select="descendant-or-self::*[name() = $sortField]" order="{$sortOrder}" data-type="{$sortType}"/>
			</xsl:apply-templates>
		</xsl:copy>
	</xsl:template>
	
</xsl:stylesheet>
